import React, { useState } from 'react'
import { LeftOutlined } from '@ant-design/icons';
import { Link, useNavigate, useParams } from 'react-router-dom';
import { Button, Form, Input, Radio } from 'antd';
import { puzwydingdan } from '../../api/api';

export default function Pingjia() {
  const navigate = useNavigate()
  const [form] = Form.useForm();
  const {id} = useParams()
  const onFinish = (values) => {
    console.log('Success:', values);
    puzwydingdan({id,ping:JSON.stringify(values)}).then(res=>console.log(res))
  };
  console.log(id);
  return (
    <div>
       <header style={{display:'flex',alignItems: 'center',justifyContent: 'space-between',padding:'0 10px',height:'50px'}}>
        <LeftOutlined onClick={()=>{
          navigate(`/dinglist`)
        }}/>
        <h4>评价</h4>
        <div onClick={()=>{
          alert('评价完成')
          navigate(`/dinglist`)
        }}>确定</div>
      </header> 
      <Form
        form={form}
        layout={'vertical'}
        onFinish={onFinish}
      >
        <Form.Item label="产品" name="can">
          <Radio.Group >
            <Radio.Button value="满意">满意</Radio.Button>
            <Radio.Button value="一般">一般</Radio.Button>
            <Radio.Button value="不满意">不满意</Radio.Button>
          </Radio.Group>
        </Form.Item>
        <Form.Item label="服务" name="fu">
            <Radio.Group >
              <Radio.Button value="满意">满意</Radio.Button>
              <Radio.Button value="一般">一般</Radio.Button>
              <Radio.Button value="不满意">不满意</Radio.Button>
            </Radio.Group>
        </Form.Item>
        <Form.Item label="意见和建议" name="text">
          <Input placeholder="input placeholder" />
        </Form.Item>
        <Form.Item>
          <Button type="primary"  htmlType="submit">Submit</Button>
        </Form.Item>
      </Form>
      
    </div>
  )
}
